package com.seari.vehbaseP.bean;

public class CommonPartResponse<V> {
    private int code;
    private String msg;
    private int total;
    private V data;

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public CommonPartResponse() {
    }

    public CommonPartResponse(int code, String msg, V data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public CommonPartResponse(int code, String msg, int total, V data) {
        this.code = code;
        this.msg = msg;
        this.total = total;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public V getData() {
        return data;
    }

    public void setData(V data) {
        this.data = data;
    }

    public static <V> CommonPartResponse success(String msg, V data) {
        return new CommonPartResponse(1, msg, data);
    }

    public static <V> CommonPartResponse failure(String msg, V data) {
        return new CommonPartResponse(0, msg, data);
    }

    public static <V> CommonPartResponse success(String msg,int toal, V data) {
        return new CommonPartResponse(1, msg,toal, data);
    }

    public static <V> CommonPartResponse failure(String msg,int toal, V data) {
        return new CommonPartResponse(0, msg,toal, data);
    }
}
